-
-
Notifications
You must be signed in to change notification settings - Fork 404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easy definition of sanitized substitutions #312
Conversation
I think this PR is ready to merge. Here is an example of what it allows you to do: layout = (hv.Image(np.random.rand(10,10),
group=('Spectrum', 'Frequency spectrum'),
label=('Glucose', '$C_6H_{12}O_6$'))
+ hv.Image(np.random.rand(10,10),
group=('Spectrum', 'Frequency spectrum'),
label=('Water', '$H_2O$'))) Now you can select the two parts of the layout conveniently with To make this less awkward, you can do this using the new al = hv.util.Aliases(Spectrum='Frequency spectrum',
Water='$H_2O$',
Glucose='$C_6H_{12}O_6$')
(hv.Image(np.random.rand(10,10), group=al.Spectrum, label=al.Glucose)
+ hv.Image(np.random.rand(10,10), group=al.Spectrum, label=al.Water)) Lastly, the same principles apply setting dimension names using tuples: im =hv.Image(np.random.rand(10,10),
kdims=[('Lambda', '$\Lambda$'), ('Joules', 'Energy ($J$)')]) Which now makes methods such as select easier: im.select(Lambda=(-0.2, 0.2), Joules=(-0.3, 0.3)) Of course you can use the After I add some tests, I think this is ready to merge and I definitely think it will help scientists (and anyone using LaTeX and special symbols really!) use HoloViews productively. |
I've now added unit tests (based on the examples above) and once they pass, I think it is ready to merge (unless you have any comments!). It is worth mentioning one limitation of this new system, the group/label/dimension name stays a string (the long string, not the short alias) which means your alias definitions won't be pickled together with the object. Aliases are defined as dictionaries (the |
Looks good, very happy to finally have a nice way to specify aliases. Since the tests are passing and I have no specific comments I'll go ahead and merge. |
Easy definition of sanitized substitutions
Excellent! Looks great. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR aims to address issue #264.